import asyncio
import json
from core.platforms.facebook.facebook import FaceBookClient
async def simple_test():
    """简单测试LinkedIn搜索"""
    print("开始LinkedIn搜索测试...")
    #chrome.exe  --remote-debugging-port=9227 --user-data-dir="C:\data"
    # chrome_manager = get_chrome_manager()
    # proxy_config={"server":"socks5://152.70.140.2:45029","username":"rdb68c7c568a6398","password":"iCTHofb7ESVwYZKWeg"}

    # browser_data=chrome_manager.create_browser(proxy_config=proxy_config)
    # browser_data=chrome_manager.open_browser("fd48d714-e32b-4000-8b1a-16fe927591a3",proxy_config=proxy_config)
    # print(browser_data)
    # service = LinkedInClient(debug_port=9227)
    filepath='D:\\rpa-workflow1\\overseas-media-rpa\\backend\\rpa-service\\data\\cookies\\facebook_1758177835_cookies.json'
    with open(filepath, 'r', encoding='utf-8') as f:
            cookie = json.load(f)
    service = FaceBookClient(debug_port=9227,cookie=cookie)
    
    try:
       
      

        # 执行搜索任务
        print("开始执行搜索...")
        result = await service.run_chatting( )
        
        print("搜索完成!")
        print(f"结果: {result}")
   
        # await service.close()
        
      
        
      
        
    except Exception as e:
        print(f"测试失败: {str(e)}")
        await service.close()


if __name__ == "__main__":
    asyncio.run(simple_test())
